package com.aboo.common.util;

import java.util.Locale;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.MessageSource;

/**
 * 简单封装的国际化方法
 * @author 娄安
 * @date 2013-6-3
 */
public class I18NUtil {
	
	@Autowired
	@Qualifier("messageSource")
	private MessageSource ms;
	
	public String getMessage(String code) {
		return ms.getMessage(code, null, Locale.CHINA);
	}
	
	public String getMessage(String code, Object[] args) {
		return ms.getMessage(code, args, Locale.CHINA);
	}
	
	public String getMessage(String code, Object[] args, Locale locale) {
		return ms.getMessage(code, args, locale);
	}
	
	public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
		return ms.getMessage(code, args, defaultMessage, locale);
	}

}
